package tech.yunland.shop.domain.service;

import com.moyuer.bsf.domain.model.Organ;
import com.moyuer.bsf.domain.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tech.yunland.cms.domain.dao.CategoryDao;
import tech.yunland.cms.domain.model.Category;

/**
 * Created by yunland03 on 16-11-17.
 */
@Service
public class MainCategoryInitImpl implements IMainCategoryInit {

    @Autowired
    private CategoryDao categoryDao;

    @Override
    public Boolean initCategory(String organId) {
        return false;
    }

    @Override
    public Boolean initCategory(Organ organ, User user) {
        Category category = new Category();
        category.setOrgan(organ);
        category.setCreator(user);
        category.setName("主栏目");
        category.setState(1);
        category.setViewType(Category.ViewType.list);
        categoryDao.saveOrUpdate(category);
        return true;
    }
}
